VB Webbrowserؼʹ÷(1)-VBؼݸѧԺڲݸɳҡרҵļ̳ վͼ 
  ѧϰITѶ缼IT֤ 
  ݿѧԺ齻ĵݸ֪ԱıԣCC++C#.NETJAVAVB̻ݽṹWEBWEBPHPJSPASPǰλ: 
ҳ > VB > VBؼ > £VB Webbrowserؼʹ÷(1) VB Webbrowserؼʹ÷(1)
ߣ Դ ʱ䣺08-02-16 40744  
      ¼ݣ 
      ύform1  
      Private Sub Command1_Click()  
      WebBrowser1.Document.Forms("form1").submit  
      End Sub  
      form1еΪuΪã  
      Private Sub Command2_Click()  
      WebBrowser1.Document.Forms("form1").u.setAttribute "disabled", "disabled"  

      End Sub 
      form1еΪuTextеΪabc  
      Private Sub Command2_Click()  
      WebBrowser1.Document.Forms("form1").u.setAttribute "value", "abc"  
      End Sub 
        
      1Ϣ  
      Private Sub Command1_Click()  
      WebBrowser1.Navigate "http://www.applevb.com"  
      End Sub  
      Private Sub Command2_Click()  
      Dim oWindow  
      Dim oNav  
      Set oWindow = WebBrowser1.Document.parentWindow  
      Set oNav = oWindow.navigator  
      Debug.Print oNav.userAgent  
      Set oWindow = Nothing  
      Set oNav = Nothing  
      End Sub  
      Command1ҳCommand2Ϣ  
      2WebbrowserϢ  
      Dim oWindow  
      Set oWindow = WebBrowser1.Document.parentWindow  
      oWindow.confirm "abcd"  
      VBwebbrowserɼ2  
      WebbrowserдHTMLݵļַ  
      Form_Loadм  
      WebBrowser1.Navigate "about:blank"  
      ȷWebbrowser1  

      1  
      Dim s As String  
      Dim stream As IStream  
      s = ""  
      s = s + ""  
      s = s + ""  
      s = s + "  
      hello world  
      "  
      s = s + ""  
      s = s + "  
      WebBrowser1.Document.Write s  

      2  
      Dim o  
      Set o = WebBrowser1.Document.selection.createrange  
      Debug.Print o  
      If (Not o Is Nothing) Then  
      o.pasteHTML ""  
      Set o = Nothing  
      End If  

      3  
      ı  
      Dim o  
      Set o = WebBrowser1.Document.selection.createrange  
      o.execCommand "InsertTextArea", False, "xxx"  
      vbWebbrowserɼ3  
      1ҳ  
      Private Sub Command2_Click()  
      WebBrowser1.Document.parentwindow.scrollby 0, 30  
      End Sub  
      Private Sub Form_Load()  
      WebBrowser1.Navigate "http://www.applevb.com"  
      End Sub  

      Command2Ϳʹǰҳ¹30  

      2жҳǷǰ  
      Private Sub Command1_Click()  
      WebBrowser1.GoForward  
      End Sub  
      Private Sub Command2_Click()  
      WebBrowser1.GoBack  
      End Sub  
      Private Sub Form_Load()  
      WebBrowser1.Navigate "http://www.applevb.com"  
      End Sub  
      Private Sub WebBrowser1_CommandStateChange(ByVal Command As Long, ByVal 
      Enable As Boolean)  [Page]
      If (Command = CSC_NAVIGATEBACK) Then  
      Command2.Enabled = Enable  
      End If  
      If (Command = CSC_NAVIGATEFORWARD) Then  
      Command1.Enabled = Enable  
      End If  
      End Sub  
      VBwebbrowserɼ4  
      1ʹҳֹ  
      Private Sub mnuScroll1_Click()  
      @#ע⣺ҳȫʾ֮ſ  
      WebBrowser1.Document.body.Scroll = "no" @#ʾİ취  
      End Sub  
      Private Sub mnuScroll2_Click()  
      @#ע⣺ҳȫʾ֮ſ  
      WebBrowser1.Document.body.Scroll = "Auto" @#ʾİ취  
      End Sub  
      2λҳбѡвֵHTML  
      Private Sub Command1_Click()  
      Dim objSelection  
      Dim objTxtRange  
      Set objSelection = WebBrowser1.Document.selection  
      If Not (objSelection Is Nothing) Then  
      Set objTxtRange = objSelection.createRange  
      If Not (objTxtRange Is Nothing) Then  
      Debug.Print objTxtRange.htmlText  
      Set objTxtRange = Nothing  
      End If  
      Set objSelection = Nothing  
      End If  
      End Sub  
      Private Sub Form_Load()  
      WebBrowser1.Navigate "http://www.applevb.com"  
      End Sub  
      Navigate       ʽ Ϊ  
      WebBrowser   .Navigate URL  
      [Flags,][TargetFrameName,][PostData,][Headers]  
      ---- WebBrowser   ֧    Ҫ   :  
      GoBack        һ   
      GoForward        һ   
      GoHome     ҡ     ҳ  
      Stop    ͣ ֹ    
      Refresh    ˢ ¡  
      Navigate       
      ---- WebBrowser     Ӧ   :  
      ---- BeforeNavigate        ʼ   ǰ   һ     ȡ   URL    
       


һƪʹVisual Basic6ģؼ   һƪVBͨſؼMSCommʹ÷һ 
  5ҳһҳ12345һҳ[ղ] [Ƽ] [(ȣ0)] [ض] [ӡҳ] [رմ] 
   û עᣩ 룺     
      ͣ      
      飺        


      ۣ

  û 
  ¡VB״ؼֱ߿ؼVBļԻԡVBļԻĽṹVBͨöԻķVBͨöԻĻԡVBͨöԻؼVBؼӦXP+⡤VBͨſؼMSCommʹ÷VBͨſؼMSCommʹ÷һVB 
  Webbrowserؼʹ÷ʹVisual 
  Basic6ģؼVBԺͳ¼VBѡԺͳ¼VBѡťVBʱؼVBıĳ¼ͷVBıĳԡVBǩĳԺ¼ݸ֪ؼ¼Copyright 
&copy; 2007-2009 Igrass.COM ITݸѧԺ Ȩ 
֧֣DedeCms QQ712012080 ICP06124365  